<?php
    foreach($categories as $row){
        $categories_aux[] = $row;
    }
?>
<h1>Registrar nuevo producto (Paso 1 de 3)</h1>
<form action="<?php echo url_for("@products_new_step_1_save"); ?>" method="post">
<table width="100%" class="table_list" border="1" cellspacing="0" cellpadding="5">
    <thead>
        <tr>
            <td colspan="2" align="center">Datos Generales</td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Nombre</td>
            <td><input type="text" name="txtName" placeholder="Ejemplo: Camisa azul clásica temporada invierno" /></td>
        </tr>
        <tr>
            <td>Url</td>
            <td>http://www.misitio.com/product/<input type="text" name="txtUrl" placeholder="Url" /></td>
        </tr>
        <tr>
            <td>Descripción</td>
            <td>
                <textarea name="txtDescription" rows="4" cols="50"></textarea>
            </td>
        </tr>
        <tr>
            <td>Categoría</td>
            <td>
                <ul>
                    <?php foreach($categories_aux as $category1){ ?>
                        <?php if($category1->getParentId()==null){ ?>
                            <li>
                                <input type="radio" name="rbCategory" value="<?php echo $category1->getId(); ?>" />
                                <?php echo $category1->getName(); ?>
                            </li>
                            <ul>
                                <?php foreach($categories_aux as $category2){ ?>
                                    <?php if($category2->getParentId()==$category1->getId()){ ?>
                                        <li>
                                            <input type="radio" name="rbCategory" value="<?php echo $category2->getId(); ?>" />
                                            <?php echo $category2->getName(); ?>
                                        </li>
                                        <ul>
                                            <?php foreach($categories_aux as $category3){ ?>
                                                <?php if($category2->getId()==$category3->getParentId()){ ?>
                                                <li>
                                                    <input type="radio" name="rbCategory" value="<?php echo $category3->getId(); ?>" />
                                                    <?php echo $category3->getName(); ?>
                                                </li>
                                                <?php } ?>
                                            <?php } ?>
                                        </ul>
                                    <?php } ?>
                                <?php } ?>
                            </ul>
                        <?php } ?>
                    <?php } ?>
                </ul>
            </td>
        </tr>
        <tr>
            <td>Precio Estándar</td>
            <td>S/.<input type="text" name="txtPrice" placeholder="Ejemplo: 49.90" /></td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <input type="submit" value="Continuar" />
            </td>
        </tr>
    </tbody>
</table>
</form>